aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/[lang=lang]/sections/products.svelte
blob: dba583562132c60b250c0b39ac8a00756ae91078 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<script context="module" lang="ts">
	import type { SanityBlockArray } from "$lib/sanity/types/block-array";
	export type ProductsModel = {
		products: ProductModel[];
	};

	export type ProductModel = {
		title: string;
		duration: string;
		cost: string;
		description: SanityBlockArray;
		orderLink: string;
	};
</script>

<script lang="ts">
	import CardV4 from "$components/card-v4.svelte";
	import LL from "$i18n/i18n-svelte";

	export let model: ProductsModel;

	let visible = true;
	$: if (!model.products || !model.products.length) {
		visible = false;
	} else {
		visible = true;
	}
</script>

{#if visible}
	<div class="wrapper">
		{#each model.products as product}
			<CardV4 description={product.description} title={product.title}>
				<div class="flex flex-wrap justify-end align-bottom">
					<a href={product.orderLink} class="btn btn--primary">{$LL.goToBookingPage()}</a>
				</div>
			</CardV4>
		{/each}
	</div>
{/if}

<style lang="postcss">
	.wrapper {
		display: grid;
		grid-template-columns: repeat(2, 50%);
		gap: 1em
	}
</style>